package com.itheima.tlias84.dao.mapper;

import com.itheima.tlias84.controller.po.InsertClazzParam;
import com.itheima.tlias84.controller.po.SelectClazzPageParam;
import com.itheima.tlias84.dao.entity.Clazz;
import com.itheima.tlias84.service.dto.SelectClazzDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ClazzMapper {

    List<Clazz> selectAll();

    List<SelectClazzDTO> selectPage(@Param("c") SelectClazzPageParam param);

    SelectClazzDTO selectById(@Param("id") Integer id);

    @Select("select name from clazz where id != #{c.id} and name = #{c.name}")
    String selectByName(@Param("c") InsertClazzParam param);

    int insertClazz(@Param("c") InsertClazzParam param);

    int deleteClazz(@Param("id") Integer id);

    int updateClazzById(@Param("c") InsertClazzParam param);

}